import controller.BlogController;
import dao.impl.NopeBlogRepository;
import dao.impl.SimpleBlogRepository;
import entity.Blog;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import service.impl.NopeBlogService;
import service.impl.SimpleBlogService;

public class MyApplication {
    public static void main(String[] args) {
        // XML-based Configuration Metadata
        ClassPathXmlApplicationContext applicationContext = new ClassPathXmlApplicationContext("beans.xml");

        System.out.println("MyApplication.main");
        //controller->service->dao(输出由dao)
        //BlogController blogController = new BlogController(new SimpleBlogService(new NopeBlogRepository()));
        BlogController blogController = (BlogController) applicationContext.getBean("blogController");
        Blog blog=new Blog(1L,"h1","sdd");
        blogController.save(blog);

        // 现在可以去看看之前的 sb-blog 项目，猜猜哪里能找到 IoC 容器

    }
}
